﻿using System;
using System.Threading;
using Detective.Game;
using Detective.Game.Gamepad;
using Detective.Home;
using Detective.Towns;
using Detective.View.ConsoleViews;
using Detective.World;

namespace Detective
{
    public class Program
    {
        [STAThread]
        public static void Main()
        {
            var game = new DetectiveGame();

            WorldShell.Instance.GoTo(new Moskow());

            WorldShell.Instance.CurrentTown.Goto(new PoorFlat());

            var consoleView = new MainView();

            Keyboard keyboard = new Keyboard();

            keyboard.AddObserved(consoleView);
            
            game.AppendComponent(keyboard);
            game.AppendComponent(consoleView);

            while (game.IsRun)
            {
                game.Delay(new GameTime(DateTime.Now));

                Thread.Sleep(game.GetDelayMilliSeconds());
            }
        }
    }
}
